<template>
	<view class="main">
		<u-navbar :is-back="true" title="修改密码" :background="background" back-icon-color="#000000" title-color="#33312D"
			title-bold="true"></u-navbar>
		<view class="inputs">
			<input type="text" placeholder="请输入旧密码" v-model="oldpwd"/>
			<input type="password" placeholder="请输入新密码" v-model="newpwd"/>
			<input type="password" placeholder="再次输入新密码" v-model="pwdagin"/>
		</view>
		<!-- 	<view class="inputs">
				<input type="text" placeholder="请输入新密码"  />
			</view>
			<view class="inputs">
				<input type="text" placeholder="请输入新密码"  />
			</view> -->
			<view class="ps">
				请设置6位及以上包含数字字母和特殊符号中至少两种组合的密码
			</view>
		<view class="button" @click="setpasswrod">
			确定
		</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				background: {
					backgroundColor: '#fff'
				},
				oldpwd:'',
				newpwd:'',
				pwdagin:'',
			}
		},
		onLoad() {
		},
		mounted() {
		},
		onShow() {},
		methods: {
			//修改密码
			setpasswrod(){
				console.log(this.oldpwd);
				console.log(this.newpwd);
				console.log(this.pwdagin);
				global.$http.request({
					url:'/shopapi/user/edit_pwd',
					data:{
						token:uni.getStorageSync('token'),
						pwd:this.oldpwd,
						npwd:this.newpwd,
						z_npwd:this.pwdagin
					}
				}).then(res=>{
					if(res.data.code==200){
						console.log();
						uni.showToast({
							title:res.data.msg+'请重新登录',
							icon:'none',
							duration:1000,
							mask:true,
						})
						uni.clearStorage()
						setTimeout(function(){
							uni.reLaunch({
								url:'../../logins/login/login'
							})
						},1000)
					}
				})
			}
		}
	}
</script>
<style lang="scss">
	page {
		font-family: Source Han Sans CN;
		width: 750rpx;
		margin: 0 auto;
		background-color: #f7f7f7;

		.main {
			display: flex;
			flex-direction: column;
			align-items: center;
			width: 750rpx;
			margin: 0 auto;

			.inputs {
				width: 750rpx;
				margin-top: 20rpx;

				input {
					background-color: #fff;
					padding: 34rpx 30rpx;
					margin-bottom: 2rpx;
				}
			}
			.ps{
				font-size: 22rpx;
				font-weight: 400;
				color: #BBBBBB;
				opacity: 1;
				padding: 32rpx 0 110rpx 0;
			}
			.button{
			
				width: 400rpx;
				background: rgba(226, 34, 34, 1);
				padding: 33rpx 0;
				font-size: 30rpx;
				font-weight: 400;
				color: #FFFFFF;
				text-align: center;
				border-radius: 100rpx;
			}
		}
	}
</style>
